package 条件判断;

import java.util.Scanner;

public class Main {
	
	public static void test01() {
		int a = 7;
		double x = 2.5,y=4.7;
		System.out.println(x+a%3*(int)(x+y)%2/4);
	}
	
	public static void test02() {
		int a = 2,b=3;
		double x = 3.5,y=2.5;
		System.out.println((float)(a+b)/2+(int)x%(int)y);
	}
	
	public static void test03() {
		Scanner sc = new Scanner(System.in);
		System.out.println("请输入第一个数");
		double a = sc.nextDouble();
		System.out.println("请输入第二个数");
		double b = sc.nextDouble();
		
		System.out.printf("和为：%f\n",a+b);
		System.out.printf("差为：%f\n",a-b);
		System.out.printf("积为：%f\n",a*b);
		System.out.printf("商为：%f\n",a/b);
		System.out.printf("摸为：%f\n",a%b);
	}
	
	public static void test04() {
		Scanner sc = new Scanner(System.in);
		System.out.println("请输入一个数");
		int a = sc.nextInt();
		int b1,b2,b3,b4;
		if(a > 9999 || a < 1000)
			System.out.println("错误信息");
		else {
			b1 = a / 1000;
			b2 = a / 100 % 10;
			b3 = a / 10 % 10;
			b4 = a % 10;
			System.out.println(b1 + b2 + b3 + b4);
		}
	}
	
	public static void test05() {
		Scanner sc = new Scanner(System.in);
		System.out.println("请输入同学的成绩");
		int a = sc.nextInt();
		if(a >= 0 && a <= 59)
			System.out.println("A");
		else if(a >= 60 && a <= 80)
			System.out.println("B");
		else if(a >= 81 && a <= 100)
			System.out.println("C");
	}
	
	public static void test06() {
		Scanner sc = new Scanner(System.in);
		System.out.println("请输入性别");
		String c = sc.next();
		System.out.println("请输入年龄");
		int i = sc.nextInt();
		System.out.println("请输入是否已婚");
		String s = sc.next();
		if(s.equals("是")) {
			System.out.println("允许买保险");
			return;
		}
		if(c.equals("男")) {
			if(i >= 25) 
				System.out.println("允许买保险");				
			else
				System.out.println("不允许买保险，因为成年男性需要25及以上年龄才能买保险");
		}else {
			if(i >= 22) 
				System.out.println("允许买保险");	
			else
				System.out.println("不允许买保险，因为成年女性需要22及以上年龄才能买保险");
		}
	}
	
	public static void test07() {
		Scanner sc = new Scanner(System.in);
		System.out.println("请输入是否为会员（是或否）");
		String c = sc.next();
		System.out.println("请输入总价");
		double i = sc.nextDouble();
		if(c.equals("是")) {
			if(i > 100) 
				System.out.printf("打八折，折后价为%f\n",i/10*8);				
			else
				System.out.printf("打九折，折后价为%f\n",i/10*9);
		}else {
			if(i > 100) 
				System.out.printf("打九折，折后价为%f\n",i/10*9);	
			else
				System.out.printf("打十折，折后价为%f\n",i);
		}
		
	}

    public static void test08() {
        Scanner sc = new Scanner(System.in);
        int[] arr = new int[4];
        for(int i = 0;i < 4;++i) {
            System.out.printf("请输入%c:\n",i+97);
            arr[i] = sc.nextInt();
        }
        int max = 0;
        for(int i = 1;i < 4;++i)
            if(arr[i] > arr[max])
                max = i;
        System.out.printf("%c的值为%d，%c最大",max+97,arr[max],max+97);
    }

    public static int[] arra = new int[3];
    public static void fuzhu(int a,int b) {
        if(arra[a] > arra[b]) {
            int m = arra[a];
            arra[a] = arra[b];
            arra[b] = m;
        }
    }
    public static void test09() {
        Scanner sc = new Scanner(System.in);
        for(int i = 0;i < 3;++i) {
            System.out.printf("请输入第%d个值:\n",i+1);
            arra[i] = sc.nextInt();
        }
        fuzhu(0,1);
        fuzhu(0,2);
        fuzhu(1,2);
        for(int i = 0;i < 3;++i) {
            System.out.print(arra[i]+" ");
        }
    }

    public static void test10() {
        Scanner sc = new Scanner(System.in);
        int num = sc.nextInt();
        if(num % 3 == 0)
            System.out.println("是三的倍数");
        else
            System.out.println("不是三的倍数");
    }

    public static void test11() {
        Scanner sc = new Scanner(System.in);
        String str = sc.next();
        switch(str){
            case "a":case "e":case "i":case "o":case "u":
                System.out.println("是元音字母");
                break;
            default:
                System.out.println("不是元音字母");
        }
    }

    public static void test012() {
        Scanner sc = new Scanner(System.in);
        int month = sc.nextInt();
        switch(month) {
            case 1:case 2:case 3:
                System.out.println("现在是春天");
                break;
            case 4:case 5:case 6:
                System.out.println("现在是夏天");
                break;
            case 7:case 8:case 9:
                System.out.println("现在是秋天");
                break;
            case 10:case 12:case 13:
                System.out.println("现在是冬天");
                break;
            default:
                System.out.println("输入有误");
        }
    }

    public static void test013() {
        Scanner sc = new Scanner(System.in);
        System.out.println("请输入第一个数");
        double num1 = sc.nextDouble();
        System.out.println("请输入一种运算");
        String y = sc.next();
        System.out.println("请输入第二个数");
        double num2 = sc.nextDouble();
        switch(y) {
            case "+":
                System.out.printf("结果为%f\n",num1 + num2);
                break;
            case "-":
                System.out.printf("结果为%f\n",num1 - num2);
                break;
            case "*":
                System.out.printf("结果为%f\n",num1 * num2);
                break;
            case "/":
                if(num2 == 0) {
                    System.out.println("输入有误");
                    break;
                }
                System.out.printf("结果为%f\n",num1 / num2);
                break;
            default:
                System.out.println("输入有误");
                break;
        }
    }

	public static void main(String[] args) {
        test07();
	}

}
